﻿<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<title>币行情</title>
    <include file="public@head_reden"/>
    <script src="/dongtai/echarts/test2/lib/esl.js"></script>
    <script src="/dongtai/echarts/test2/lib/config.js"></script>
    <script src="/dongtai/echarts/test2/lib/jquery.min.js"></script>
    <script src="/dongtai/echarts/test2/lib/facePrint.js"></script>
    <style type="text/css">
        span {
            display: inline;
        }
        #main {
            overflow: hidden;
            height: 360px;
        }
    </style>
</head>


<body>
<div id="content">
  <header class="header pd3"  style="height: 1px">
  </header>
  <div class="pd3">
    <section class="icons-three">
    <img class="head" src="/upload/{$img_url}"><p class="name">{$coin_symbol}</p>
     <ul>
      <li><span>现金估值</span><p>${$usd_price}</p></li>
      <li><span>今日涨幅</span><p>
            <if condition="$price_change egt 0">
              <font class="blue">+{$price_change}%</font>
            <else /> 
              <font class="red">{$price_change}%</font>
            </if>        
      </p></li>
      <li><span>7日涨幅</span><p>
            <if condition="$price_change_week egt 0">
              <font class="blue">+{$price_change_week}%</font>
            <else /> 
              <font class="red">{$price_change_week}%</font>
            </if>            
      </p></li>
     </ul>
    </section>
<!--     <section class="stit1">
      <p>k线(天)</p>
    </section>
    <section class="icons-line">
     <img src="__TMPL__/public/assets/images/form1.png" width="100%">
    </section>
 -->
        <section class="btc-k-con pd3">
            <div id="main"></div>
        </section>

  </div>
    <section class="icons-form">
    <ul class="icons-form-tit"><li >交易所</li><li>最新价</li><li>跌涨幅</li> </ul>
     <table>
      
      <tbody>
      <tr>
        <foreach name="ticker_info" item="vo">
          <td width="15%">
            <img src="/upload/icon/{$vo.exchange_class}.png">
          </td>
          <td width="42%">
            <p class="bigword">
              <span class="nam">{$vo.coin}</span>
              <span class="ft">/{$vo.currency}</span></p>
              <p class="sword"><i>24h量</i><i>{$vo.volume}</i></p>
          </td>
          <td  width="23%">
              <p class="bigword">{$vo.price}</p>
              <p class="sword">${$vo.price}</p>
          </td>
          <td width="20%">
            <if condition="$vo.change egt 0">
              <p class="qs qs-green">{$vo.change}%</p>
            <else /> 
              <p class="qs qs-red">{$vo.change}%</p>            
            </if>
          </td>
             </tr>
        </foreach>
      </tr>

      </tbody>
     </table>
    
    </section>
    
     
  
</div>

<script src="/dongtai/js/dongtai.js"></script>
<script src="/dongtai/js/htoken_hangqing_kline.js"></script>
<script language="javascript">

    function init() {
        if (exchange == '') {
            exchange = 'OKEx';
            market = '{$coin_symbol}/USDT';
            currency = 'CNY';
            timeframe = '1d';
        }
        get_kline_data(exchange,market,currency);

        // setInterval(function(){
        //     get_kline_data(exchange,market,currency);
        // }, 5000);
    }


    function get_kline_data(exchange='OKEx',market='BTC/USDT',currency="CNY",timeframe='1m'){
        var post_data={
            exchange:exchange,
            market:market,
            currency:currency,
            timeframe:timeframe
        }
        $.ajax({
            headers: {
                'XX-Token':token,
                'XX-Device-Type':device_type
            },
            type: "POST",
            url: domain + "/api/trade/public/kline",
            data: post_data,
            success: function (data_yc) {
                if(data_yc.code == 1){
                    var data_yc = data_yc.data;
                    kdata = [];
                    if (data_yc.length > 50) {
                        var i = (data_yc.length - 50);
                    }else{
                        var i = 0;
                    }
                    for (i;i<data_yc.length; i++) {
                        kdates.push(transformTime(data_yc[i][0]));
                        kdata.push([data_yc[i][1],data_yc[i][4],data_yc[i][3],data_yc[i][4],data_yc[i][5]]);
                        kvolumns.push(data_yc[i][5]);
                    }
                    //console.log(kdates);
                    //console.log(kdata);
                    //console.log(kvolumns);
                    refreshData();
                }else{
                    Toast(data.msg,2000);
                }
            }
        });
    }
init();
</script>

</body>
</html>
